﻿@model DSAAssignment.Models.FaultModel

@{
    ViewBag.Title = "ManageFault";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">
    $(document).ready(function () {
        $('.search').hide();
        $('.search1').hide();
    })

    function Search1() {
        $('.search').slideToggle();
        $('.search1').hide();
    }

    function Search2() {
        $('.search').slideToggle();
        $('.search1').slideToggle();
    }

    $('#search').click(function () {
        var id = document.getElementById("txtSearch").value;

        $.ajax({

            type: "POST",
            url: "/User/SearchFaultByUserName",
            data: "{UserName:'" + id + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (info) {
                alert("Succeed");
            },
            error: function (error) {
                alert("Adding of Product Failed Misrably");

            }
        });
    });
</script>

<h2>ManageFault</h2>
<a id="SearchID" href="" onclick="Search1(); return false;">Search By ID</a>   |   <a id="SearchDate" href="" onclick="Search2(); return false;">Search By Date</a>
<br />

<div id="Search" class="search">
Enter ID: <input type="text" id="txtsearch" /><a href="" onclick="search();">Search By UserName</a>  |  <a href="">Search By Fault ID</a>
@Html.ActionLink("By UserName", "SearchFaultByUserName", new { Controller = "User", id = "txtsearch" }, null)


<form method="post" action="@Url.Action("SearchFaultByUserName", "User")">
    <input type="text" id="txtSearch" />
    <input type="submit" value="Search" />
</form>
</div>


<div id="Search2" class="search1">
Date From : <input type="text" id="txtDateFrom" />  Date To : <input type="text" id="txtDateTo" /><a href="">Search By Dates</a>
</div>
<br />

<div id="FaultsList">
    @Html.Action("FaultsList", "Website")
</div>
